<template>
  <div class="menuLeft">
    <div class="headPortrait">
      <div class="left">
        <img :src="profile.avatarUrl" alt="">
        <span>{{profile.nickname}} &gt;</span>
      </div>
      <div class="right">
        <SvgView ion='#icon-saoma' />
      </div>
    </div>
    <div class="vip">
      <div class="vipHead">
        <img :src="vip.levelCard?.accountPageIconImgUrl" alt="">
      </div>
    </div>
    <div class="group">
      <van-cell-group>
        <van-cell title="消息中心" is-link />
        <van-cell title="云贝中心" is-link value="签到" />
      </van-cell-group>
    </div>
    <div class="group">
      <van-cell-group>
        <van-cell title="我的客服" is-link />
        <van-cell title="我的订单" is-link />
        <van-cell title="优惠券" is-link />
        <van-cell title="分享网易云音乐" is-link />
        <van-cell title="云村邮票" is-link />
        <van-cell title="音乐闹钟" is-link />
        <van-cell title="设置" is-link />
        <van-cell title="定时关闭" is-link />
        <van-cell title="个性装扮" is-link />
      </van-cell-group>
    </div>
    <div class="exit" @click="exit">
      退出登录
    </div>
  </div>
</template>

<script setup>
import { loginStatus } from '@/assets/axios/login'
import { getVip } from "@/assets/axios/api"
import { onMounted, ref } from 'vue';
import { useRouter } from "vue-router";
const router = useRouter();
const profile = ref({})
const account = ref({})
const vip = ref({})
onMounted(async () => {
  const result = await loginStatus()
  const res = await getVip()
  vip.value = res.data.data
  profile.value = result.data.data.profile
  account.value = result.data.data.account

})
const exit = () => {
  router.push('/login')
}
</script>

<style scoped lang="less">
.menuLeft {
  width: 100%;
  background-color: #f2f2f2;
  padding: 0 10px;

  .headPortrait {
    width: 100%;
    height: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;

    .left {
      display: flex;
      align-items: center;

      img {
        border-radius: 50%;
        width: 20px;
        height: 20px;
        margin-right: 20px;
      }
    }

  }

  .vip {
    width: 100%;
    height: 100px;
    padding: 5px;
    border-radius: 10px;
    background: linear-gradient(90deg, rgba(0, 0, 0, 1) 0%, rgba(82, 64, 64, 1) 100%);
    margin-top: 10px;

    .vipHead {
      display: flex;
      align-items: center;
      justify-content: space-between;

      img {
        width: 80px;
      }
    }
  }

  .group {
    margin-top: 10px;
    border-radius: 10px;
    overflow: hidden;
  }

  .exit {
    text-align: center;
    font-size: 16px;
    border-radius: 10px;
    margin-top: 10px;
    color: red;
    height: 40px;
    line-height: 40px;
    width: 100%;
    background-color: white;
  }
}
</style>